<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Identi Engine Documentation - Profiles</title>

<link rel="stylesheet" href="../css/site.css" type="text/css" media="all" />
<link rel="stylesheet" href="../css/documentation.css" type="text/css" media="all" />
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
<link rel="shortcut icon" href="../images/logo16.png"/>

<link type="application/rss+xml" rel="alternate" title="Ident Engine (RSS)" href="http://identengine.com/Blog/syndication.axd?format=rss" />
<link type="application/atom+xml" rel="alternate" title="Ident Engine (ATOM)" href="http://identengine.com/Blog/syndication.axd?format=atom" />

</head>

<body>
	<div class="header">
		<div class="centered">
			<a href="http://identengine.com/"><h1><span>Ident Engine</span></h1></a>
			<h2 id="strapline"><span>sharing and syncing your job seeking information across the web</span> </h2>
		</div>
	</div>

	<div class="content">
		<div class="centered">
		<div class="floatclear" style="clear:both">
			<ul class="menu">
				<li><a href="../index.htm" class="firstItem">home</a></li>
				<li><a href="index.htm">documentation</a></li>
				<li><a href="../opentables/index.htm">api</a></li>
				<li><a href="http://identengine.com/blog/">blog</a></li>
				<li><a href="../about/index.htm" class="lastItem">about</a></li>
			</ul>
		</div>	

	
		<h1>Documentation - Profiles</h1>
		
		<p class="title-expansion">How to search for and retrieve an individuals profiles from across the web.</p>

		<p>The Identi Engine has the ability to retrieve a collection of 
		profiles from an individual&#39;s distributed identity across the web. It 
		stores this information in a collection called ident.profiles. See 
		demo: <a href="../profile-discovery.htm">Profile Discovery</a></p>
		
		<h2>1. Creating a search</h2>
		
<pre>var doc = jQuery(document);

doc.ready(function () {
    ident.useInwardEdges = true;
    doc.bind('ident:update', renderProfile);

    ident.search(&#39;http://twitter.com/glennjones&#39;);
 });</pre>
 
		<p> 
		The code snippet above is using jQuery to create a function which 
		executes as soon as the HTML document is loaded. 
		</p>
		
		<h3>Properties</h3>
		    <dl>
				<dt>useInwardEdges</dt>
                <dd>The useInwardEdges property controls how the identities are found. If it is 
		set to true it will return a larger sets of results, but there is a 
		greater chance that Identi Engine will return the wrong information about an 
		individual. There will be less of a chance of error if the property is 
		set to false. By default this 
		property is set&nbsp; to true.</dd>
		                            
   
            </dl>
		
		<h3>Binding the rendering function</h3>
		
		<p>The Identi Engine will update the identities collection a number of 
		times during a single search. To capture the updates we need to bind our 
		own rendering function to the events fired by the library. 
		This can be done easily with jQuery for example:</p>
		<pre> doc.bind(&#39;identi:update&#39;, renderProfile);</pre>
		<p>The code above will call&nbsp; the function renderProfile&nbsp; 
		every time the Identi Engine updates it profiles collection.
		</p>
		
		<h2>2. Rendering results</h2>
		
		<pre>
function renderProfile(e){

   jQuery('#profiles').html('');
   ident.profiles.sort(ident.sortByDomain);

   for (var i = 0; i &lt; ident.profiles.length; i++) {

      var hCard = ident.profiles[i];
      var div = jQuery(&#39;&lt;div class=&quot;profile&quot;&gt;&lt;/div&gt;&#39;).appendTo('#profiles');
  
      jQuery(&#39;&lt;div class=&quot;fn&quot;&gt;&#39; + hCard.fn + &#39;&lt;/div&gt;&#39;).appendTo(div);

       if( hCard.title ) 
         if(hCard.title.length &gt; 0 )
            jQuery(&#39;&lt;div class=&quot;title&quot;&gt;&#39; + hCard.title[0].value + &#39;&lt;/div&gt;&#39;).appendTo(div);
 
      ... 

}</pre>

	
		<p>Please read the page <strong><a href="profile-structure.htm">profile structure</a></strong> 
		for a complete overview of the data returned in the ident.profiles collection.</p>
	
		

		<h2>The files that need to be included in the page</h2>		
		<p>There are four files you must include 
		in your HTML for the Identi Engine to create 
		the profiles collection. </p>
		<pre >
jquery-1.3.2.min.js
identi-0.1.js
identi-profile-0.1.js
identi-yql-parser-0.1.js
</pre>
		<p>Alternatively, you can swap the parser to UfXtract which in some 
		cases will return more results. The UfXtract parser should only be 
		used for low traffic situations.</p>
		<pre>
jquery-1.3.2.min.js
identi-0.1.js
identi-profile-0.1.js
identi-ufxtract-parser-0.1.js
</pre>

<h2>Issues with Twitter profile</h2>
<p>The current hCard mark up of Twitter profiles has slowly degraded through a 
number of redesigns. To fix this one site there is a temporary hack which uses 
the YQL XPath instead of a microformats parser. To use this hack all you need to 
do is include the file: identi-twitter-parser-0.1.js. It will automatically&nbsp; override the other parsers when
a request is made for a Twitter profile.</p>

		<pre >
jquery-1.3.2.min.js
identi-0.1.js
identi-profile-0.1.js
identi-yql-parser-0.1.js
identi-twitter-parser-0.1.js
</pre>
	

</div>
		</div>
		
		
   <div class="footer">
		<div class="centered">
			<p class="cc-license">
				<a rel="license" href="http://creativecommons.org/licenses/by/2.0/uk/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/2.0/uk/80x15.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">Identi Engine Documentation</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.glennjones.net/" property="cc:attributionName" rel="cc:attributionURL">Glenn Jones</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/2.0/uk/">Creative Commons Attribution 2.0 UK: England &amp; Wales License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://identengine.com/" rel="dc:source">identengine.com</a>.
			</p>
			<p class="copyright">© Copyright Glenn Jones 2009. All Rights Reserved.</p>
		</div>
	</div>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-3021774-6");
pageTracker._trackPageview();
} catch(err) {}</script>
	

</body>
</html>
